<!DOCTYPE html>
<html>
<head>
    <title>教育管理系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="{% url 'student-list' %}">学生成绩管理系统</a>
            {% if user.is_authenticated %}
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'student-list' %}">学生管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'teacher-list' %}">教师管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'course-list' %}">课程管理</a>
                    </li>
                </ul>
                <div class="navbar-nav ms-auto">
                    <span class="nav-item nav-link text-light">欢迎, {{ user.username }}</span>
                    <a class="nav-item nav-link" href="{% url 'logout' %}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                        退出
                    </a>
                    <form id="logout-form" action="{% url 'logout' %}" method="POST" style="display: none;">
                        {% csrf_token %}
                    </form>
                </div>
            </div>
            {% endif %}
        </div>
    </nav>
    <div class="container mt-4">
        {% if messages %}
        {% for message in messages %}
        <div class="alert alert-{{ message.tags }}">
            {{ message }}
        </div>
        {% endfor %}
        {% endif %}
        {% block content %}
        {% endblock %}
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html> 